]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
messageTray: Support setImage(null) to mean unsetImage()
authorJasper St. Pierre <jstpierre@mecheye.net>
Sun, 30 Dec 2012 16:36:48 +0000 (11:36 -0500)
committerJasper St. Pierre <jstpierre@mecheye.net>
Sun, 30 Dec 2012 19:09:39 +0000 (14:09 -0500)
This is a quick API change that should clean up some conditionals.

https://bugzilla.gnome.org/show_bug.cgi?id=680414

js/ui/messageTray.js
js/ui/notificationDaemon.js

index ec93ce81eb89c8dd1a246c32b16c465a2a1b1744..517e7a9794954840515e1fe55706317eaf51d03c 100644 (file)
@@ -611,6 +611,8 @@ const Notification = new Lang.Class({
     setImage: function(image) {
         if (this._imageBin)
             this.unsetImage();
+        if (!image)
+            return;
         this._imageBin = new St.Bin();
         this._imageBin.child = image;
         this._imageBin.opacity = 230;
index 3aa86689f569ef8deda2c3773870e06d6dd15b9f..1b24883b0e107546e8472408bf66cf92e2eabbf8 100644 (file)
@@ -388,8 +388,8 @@ const NotificationDaemon = new Lang.Class({
                                              clear: true });
 
         // We only display a large image if an icon is also specified.
+        let image = null;
         if (icon && (hints['image-data'] || hints['image-path'])) {
-            let image = null;
             if (hints['image-data']) {
                 let [width, height, rowStride, hasAlpha,
                  bitsPerSample, nChannels, data] = hints['image-data'];
@@ -400,10 +400,8 @@ const NotificationDaemon = new Lang.Class({
                                                                      notification.IMAGE_SIZE,
                                                                      notification.IMAGE_SIZE);
             }
-            notification.setImage(image);
-        } else {
-            notification.unsetImage();
         }
+        notification.setImage(image);
 
         if (actions.length) {
             notification.setUseActionIcons(hints['action-icons'] == true);